package controller

import (
	"github.com/kataras/iris/v12"
	"palms/model"
	"palms/service"
)

type SellerController struct {
	sellerService service.SellerService
	robotService  service.RobotService
}

func (c *SellerController) ApplyRobot(ctx iris.Context) model.Robot {
	sellerCode := ctx.URLParam("code")
	robots, err := c.sellerService.MatchAll(sellerCode)
	result := iris.Map{
		"code":    100001,
		"data":    robots[0],
		"message": err.Error(),
	}
	err = ctx.JSON(result)

}

func (c *SellerController) GetBy(id int64) model.Robot {
	return c.sellerService.Get(id)
}

func (c *SellerController) Delete(id int64) interface{} {
	c.sellerService.Delete(id)
	return iris.StatusBadRequest
}
